#!/bin/bash

cd task1-2/judge
chmod +x ./koba

rm step1.s > /dev/null 2>&1  
rm step1.arm > /dev/null 2>&1

# 词法和语法检查 
chmod +x ./parser
./parser ../src/step1.sy
if [ $? == 0 ]; then 
./koba ../src/step1.sy -o step1.s
arm-linux-gnueabihf-gcc step1.s libsysy.a -o step1.arm

if [ ! -f "step1.arm" ]; then
echo "编译未成功！"
else  
qemu-arm -L /usr/arm-linux-gnueabihf/ ./step1.arm 
echo $?
fi

else 
echo "程序有词法或语法错误，请根据提示修改程序"
fi


